<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- Copyright 2016 TensorFlow authors.</span><span>
</span><span id="line-2"></span><span class="hs-comment">--</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- you may not use this file except in compliance with the License.</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- You may obtain a copy of the License at</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">--     http://www.apache.org/licenses/LICENSE-2.0</span><span>
</span><span id="line-8"></span><span class="hs-comment">--</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Unless required by applicable law or agreed to in writing, software</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- See the License for the specific language governing permissions and</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- limitations under the License.</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-16"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-17"></span><span class="hs-pragma">{-# LANGUAGE LambdaCase #-}</span><span>
</span><span id="line-18"></span><span class="hs-pragma">{-# LANGUAGE OverloadedStrings #-}</span><span>
</span><span id="line-19"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-20"></span><span class="hs-comment">{- | Rendering of TensorFlow operations as Haskell functions.

The basic type signature generated for each op is:

&gt; {constraints} =&gt; {mandatory attrs} -&gt; {input tensors} -&gt; {output tensors}

where:

* @{mandatory attrs}@ is of the form @A_1 -&gt; ... -&gt; A_N@, where each @A@ is an
 op attribute that doesn't have a default and can't be inferred from other
 inputs.

* @{constraints}@ restrict the type parameters of the input and output tensors
 (for example: 'TensorType' or 'OneOf').

* @{input tensors}@ is of the form @T_1 -&gt; ... -&gt; T_N@, where each @T@ is of
the form @Tensor Ref a@ or @Tensor v a@ (or a list of one of those types),
and @a@ is either a concrete type or a (constrained) type variable.

* @{output tensors}@ is of the form @(T_1,...,T_N)@ for &quot;pure&quot; ops, and
@Build (T_1,...,T_N)@ for &quot;stateful&quot; ops.  An op is considered &quot;stateful&quot; if
it takes a @Tensor Ref@ or @Tensor v ResourceHandle@ as input, or if it's
explicitly marked \&quot;Stateful\&quot; in its @REGISTER_OP@ definition.  (If there
are no outputs, it is either @ControlNode@ or @Build ControlNode@.)
-}</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">TensorFlow.OpGen</span><span>
</span><span id="line-47"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#OpGenFlags"><span class="hs-identifier">OpGenFlags</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#docOpList"><span class="hs-identifier">docOpList</span></a></span><span>
</span><span id="line-49"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#flagParser"><span class="hs-identifier">flagParser</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-51"></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Foldable</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">toList</span></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.Maybe</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">fromMaybe</span></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ProtoLens.Default</span></span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">def</span></span><span class="hs-special">)</span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.ProtoLens</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">showMessage</span></span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.List</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">sortOn</span></span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Data.List.NonEmpty</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">NonEmpty</span></span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.List.NonEmpty</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">NE</span></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Lens.Family2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-operator">(^.)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(.~)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&amp;)</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">view</span></span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Options.Applicative</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">Parser</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">help</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">long</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">strOption</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">value</span></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.OpDef</span></span><span>
</span><span id="line-62"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">OpList</span></span><span>
</span><span id="line-63"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">OpDef</span></span><span>
</span><span id="line-64"></span><span>  </span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.OpDef_Fields</span></span><span>
</span><span id="line-66"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">attr</span></span><span>
</span><span id="line-67"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">inputArg</span></span><span>
</span><span id="line-68"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">name</span></span><span>
</span><span id="line-69"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">op</span></span><span>
</span><span id="line-70"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">outputArg</span></span><span>
</span><span id="line-71"></span><span>  </span><span class="hs-special">)</span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Proto.Tensorflow.Core.Framework.Types</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">DataType</span></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">System.FilePath</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier">takeBaseName</span></span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html"><span class="hs-identifier">TensorFlow.OpGen.ParsedOp</span></a></span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><span class="hs-identifier">Text.PrettyPrint.Mainland</span></span><span>
</span><span id="line-76"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="hs-identifier">Doc</span></span><span>
</span><span id="line-77"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&lt;+&gt;)</span></span><span>
</span><span id="line-78"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&lt;/&gt;)</span></span><span>
</span><span id="line-79"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-operator">(&lt;+/&gt;)</span></span><span>
</span><span id="line-80"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">brackets</span></span><span>
</span><span id="line-81"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">comma</span></span><span>
</span><span id="line-82"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">commasep</span></span><span>
</span><span id="line-83"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">dquotes</span></span><span>
</span><span id="line-84"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">empty</span></span><span>
</span><span id="line-85"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">enclose</span></span><span>
</span><span id="line-86"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">flatten</span></span><span>
</span><span id="line-87"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">folddoc</span></span><span>
</span><span id="line-88"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">hang</span></span><span>
</span><span id="line-89"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">indent</span></span><span>
</span><span id="line-90"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">parens</span></span><span>
</span><span id="line-91"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">sep</span></span><span>
</span><span id="line-92"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">stack</span></span><span>
</span><span id="line-93"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">strictText</span></span><span>
</span><span id="line-94"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-identifier">tuple</span></span><span>
</span><span id="line-95"></span><span>  </span><span class="hs-special">)</span><span>
</span><span id="line-96"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Set</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Set</span></span><span>
</span><span id="line-97"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><span class="hs-identifier">Data.Text</span></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Text</span></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="hs-keyword">data</span><span> </span><span id="OpGenFlags"><span class="annot"><a href="TensorFlow.OpGen.html#OpGenFlags"><span class="hs-identifier hs-var">OpGenFlags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="OpGenFlags"><span class="annot"><a href="TensorFlow.OpGen.html#OpGenFlags"><span class="hs-identifier hs-var">OpGenFlags</span></a></span></span><span>
</span><span id="line-100"></span><span>     </span><span class="hs-special">{</span><span> </span><span id="outputFile"><span class="annot"><span class="annottext">OpGenFlags -&gt; String
</span><a href="TensorFlow.OpGen.html#outputFile"><span class="hs-identifier hs-var hs-var">outputFile</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">String</span></span><span>
</span><span id="line-101"></span><span>     </span><span class="hs-special">,</span><span> </span><span id="prefix"><span class="annot"><span class="annottext">OpGenFlags -&gt; String
</span><a href="TensorFlow.OpGen.html#prefix"><span class="hs-identifier hs-var hs-var">prefix</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">String</span></span><span>
</span><span id="line-102"></span><span>     </span><span class="hs-special">,</span><span> </span><span id="excludeList"><span class="annot"><span class="annottext">OpGenFlags -&gt; String
</span><a href="TensorFlow.OpGen.html#excludeList"><span class="hs-identifier hs-var hs-var">excludeList</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">String</span></span><span>
</span><span id="line-103"></span><span>     </span><span class="hs-special">}</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="annot"><a href="TensorFlow.OpGen.html#flagParser"><span class="hs-identifier hs-type">flagParser</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Parser</span></span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#OpGenFlags"><span class="hs-identifier hs-type">OpGenFlags</span></a></span><span>
</span><span id="line-106"></span><span id="flagParser"><span class="annot"><span class="annottext">flagParser :: Parser OpGenFlags
</span><a href="TensorFlow.OpGen.html#flagParser"><span class="hs-identifier hs-var hs-var">flagParser</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String -&gt; OpGenFlags
</span><a href="TensorFlow.OpGen.html#OpGenFlags"><span class="hs-identifier hs-var">OpGenFlags</span></a></span><span>
</span><span id="line-107"></span><span>     </span><span class="annot"><span class="annottext">(String -&gt; String -&gt; String -&gt; OpGenFlags)
-&gt; Parser String -&gt; Parser (String -&gt; String -&gt; OpGenFlags)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-operator hs-var">&lt;$&gt;</span></span><span> </span><span class="annot"><span class="annottext">Mod OptionFields String -&gt; Parser String
forall s. IsString s =&gt; Mod OptionFields s -&gt; Parser s
</span><span class="hs-identifier hs-var">strOption</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Mod OptionFields String] -&gt; Mod OptionFields String
forall a. Monoid a =&gt; [a] -&gt; a
</span><span class="hs-identifier hs-var">mconcat</span></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. HasName f =&gt; String -&gt; Mod f a
</span><span class="hs-identifier hs-var">long</span></span><span> </span><span class="annot"><span class="hs-string">&quot;output&quot;</span></span><span>
</span><span id="line-108"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. String -&gt; Mod f a
</span><span class="hs-identifier hs-var">help</span></span><span> </span><span class="annot"><span class="hs-string">&quot;File to write.&quot;</span></span><span>
</span><span id="line-109"></span><span>                            </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>     </span><span class="annot"><span class="annottext">Parser (String -&gt; String -&gt; OpGenFlags)
-&gt; Parser String -&gt; Parser (String -&gt; OpGenFlags)
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-operator hs-var">&lt;*&gt;</span></span><span> </span><span class="annot"><span class="annottext">Mod OptionFields String -&gt; Parser String
forall s. IsString s =&gt; Mod OptionFields s -&gt; Parser s
</span><span class="hs-identifier hs-var">strOption</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Mod OptionFields String] -&gt; Mod OptionFields String
forall a. Monoid a =&gt; [a] -&gt; a
</span><span class="hs-identifier hs-var">mconcat</span></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. HasName f =&gt; String -&gt; Mod f a
</span><span class="hs-identifier hs-var">long</span></span><span> </span><span class="annot"><span class="hs-string">&quot;prefix&quot;</span></span><span>
</span><span id="line-111"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. String -&gt; Mod f a
</span><span class="hs-identifier hs-var">help</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Haskell package prefix to use&quot;</span></span><span>
</span><span id="line-112"></span><span>                            </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-113"></span><span>     </span><span class="annot"><span class="annottext">Parser (String -&gt; OpGenFlags) -&gt; Parser String -&gt; Parser OpGenFlags
forall (f :: * -&gt; *) a b. Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-operator hs-var">&lt;*&gt;</span></span><span> </span><span class="annot"><span class="annottext">Mod OptionFields String -&gt; Parser String
forall s. IsString s =&gt; Mod OptionFields s -&gt; Parser s
</span><span class="hs-identifier hs-var">strOption</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Mod OptionFields String] -&gt; Mod OptionFields String
forall a. Monoid a =&gt; [a] -&gt; a
</span><span class="hs-identifier hs-var">mconcat</span></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. HasName f =&gt; String -&gt; Mod f a
</span><span class="hs-identifier hs-var">long</span></span><span> </span><span class="annot"><span class="hs-string">&quot;exclude_list&quot;</span></span><span>
</span><span id="line-114"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. HasValue f =&gt; a -&gt; Mod f a
</span><span class="hs-identifier hs-var">value</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-115"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Mod OptionFields String
forall (f :: * -&gt; *) a. String -&gt; Mod f a
</span><span class="hs-identifier hs-var">help</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Comma separated Ops names to ignore&quot;</span></span><span>
</span><span id="line-116"></span><span>                            </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="annot"><a href="TensorFlow.OpGen.html#docOpList"><span class="hs-identifier hs-type">docOpList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#OpGenFlags"><span class="hs-identifier hs-type">OpGenFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpList</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-120"></span><span id="docOpList"><span class="annot"><span class="annottext">docOpList :: OpGenFlags -&gt; OpList -&gt; Doc
</span><a href="TensorFlow.OpGen.html#docOpList"><span class="hs-identifier hs-var hs-var">docOpList</span></a></span></span><span> </span><span id="local-6989586621679086255"><span class="annot"><span class="annottext">flags :: OpGenFlags
</span><a href="#local-6989586621679086255"><span class="hs-identifier hs-var">flags</span></a></span></span><span> </span><span id="local-6989586621679086254"><span class="annot"><span class="annottext">opList :: OpList
</span><a href="#local-6989586621679086254"><span class="hs-identifier hs-var">opList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-121"></span><span>  </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# LANGUAGE ConstraintKinds #-}&quot;</span></span><span>
</span><span id="line-122"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# LANGUAGE DataKinds #-}&quot;</span></span><span>
</span><span id="line-123"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# LANGUAGE FlexibleContexts #-}&quot;</span></span><span>
</span><span id="line-124"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# LANGUAGE FlexibleInstances #-}&quot;</span></span><span>
</span><span id="line-125"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# LANGUAGE OverloadedStrings #-}&quot;</span></span><span>
</span><span id="line-126"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# LANGUAGE ScopedTypeVariables #-}&quot;</span></span><span>
</span><span id="line-127"></span><span>          </span><span class="hs-comment">-- Avoids reports about shadowing standard library names.</span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# OPTIONS_GHC -fno-warn-name-shadowing #-}&quot;</span></span><span>
</span><span id="line-129"></span><span>          </span><span class="hs-comment">-- eqLengthGuard never returns false and dies instead.</span><span>
</span><span id="line-130"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}&quot;</span></span><span>
</span><span id="line-131"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;module&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086253"><span class="hs-identifier hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;where&quot;</span></span><span>
</span><span id="line-132"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">empty</span></span><span>
</span><span id="line-133"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="TensorFlow.OpGen.html#imports"><span class="hs-identifier hs-var">imports</span></a></span><span>
</span><span id="line-134"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">empty</span></span><span>
</span><span id="line-135"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc -&gt; Doc) -&gt; [Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">folddoc</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679086251"><span class="annot"><span class="annottext">x :: Doc
</span><a href="#local-6989586621679086251"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679086250"><span class="annot"><span class="annottext">y :: Doc
</span><a href="#local-6989586621679086250"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086251"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">empty</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086250"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-136"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(OpDef -&gt; Doc) -&gt; [OpDef] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">OpDef -&gt; Doc
</span><a href="#local-6989586621679086249"><span class="hs-identifier hs-var">renderOpAndExtras</span></a></span><span> </span><span class="annot"><span class="annottext">([OpDef] -&gt; [Doc]) -&gt; [OpDef] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-137"></span><span>                   </span><span class="annot"><span class="annottext">(OpDef -&gt; Text) -&gt; [OpDef] -&gt; [OpDef]
forall b a. Ord b =&gt; (a -&gt; b) -&gt; [a] -&gt; [a]
</span><span class="hs-identifier hs-var">sortOn</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FoldLike Text OpDef OpDef Text Text -&gt; OpDef -&gt; Text
forall a s t b. FoldLike a s t a b -&gt; s -&gt; a
</span><span class="hs-identifier hs-var">view</span></span><span> </span><span class="annot"><span class="annottext">FoldLike Text OpDef OpDef Text Text
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;name&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">name</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([OpDef] -&gt; [OpDef]) -&gt; [OpDef] -&gt; [OpDef]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-138"></span><span>                   </span><span class="annot"><span class="annottext">(OpDef -&gt; Bool) -&gt; [OpDef] -&gt; [OpDef]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><span class="hs-identifier hs-var">filter</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (OpDef -&gt; Bool) -&gt; OpDef -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; [Text] -&gt; Bool) -&gt; [Text] -&gt; Text -&gt; Bool
forall a b c. (a -&gt; b -&gt; c) -&gt; b -&gt; a -&gt; c
</span><span class="hs-identifier hs-var">flip</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><span class="hs-identifier hs-var">elem</span></span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679086244"><span class="hs-identifier hs-var">exclusions</span></a></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Bool) -&gt; (OpDef -&gt; Text) -&gt; OpDef -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">FoldLike Text OpDef OpDef Text Text -&gt; OpDef -&gt; Text
forall a s t b. FoldLike a s t a b -&gt; s -&gt; a
</span><span class="hs-identifier hs-var">view</span></span><span> </span><span class="annot"><span class="annottext">FoldLike Text OpDef OpDef Text Text
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;name&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">name</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([OpDef] -&gt; [OpDef]) -&gt; [OpDef] -&gt; [OpDef]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-139"></span><span>                   </span><span class="annot"><span class="annottext">[OpDef] -&gt; [OpDef]
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; [a]
</span><span class="hs-identifier hs-var">toList</span></span><span> </span><span class="annot"><span class="annottext">([OpDef] -&gt; [OpDef]) -&gt; [OpDef] -&gt; [OpDef]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpList
</span><a href="#local-6989586621679086254"><span class="hs-identifier hs-var">opList</span></a></span><span> </span><span class="annot"><span class="annottext">OpList -&gt; FoldLike [OpDef] OpList OpList [OpDef] [OpDef] -&gt; [OpDef]
forall s a t b. s -&gt; FoldLike a s t a b -&gt; a
</span><span class="hs-operator hs-var">^.</span></span><span> </span><span class="annot"><span class="annottext">FoldLike [OpDef] OpList OpList [OpDef] [OpDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;op&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">op</span></span><span class="hs-special">)</span><span>
</span><span id="line-140"></span><span>        </span><span class="hs-special">]</span><span>
</span><span id="line-141"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679086253"><span class="annot"><span class="annottext">moduleName :: Text
</span><a href="#local-6989586621679086253"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-142"></span><span>            </span><span class="annot"><span class="annottext">String -&gt; Text
</span><span class="hs-identifier hs-var">Text.pack</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpGenFlags -&gt; String
</span><a href="TensorFlow.OpGen.html#prefix"><span class="hs-identifier hs-var hs-var">prefix</span></a></span><span> </span><span class="annot"><span class="annottext">OpGenFlags
</span><a href="#local-6989586621679086255"><span class="hs-identifier hs-var">flags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;.&quot;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Text
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#camelCase"><span class="hs-identifier hs-var">camelCase</span></a></span><span>
</span><span id="line-143"></span><span>             </span><span class="hs-comment">-- Discards the optional trailing _ops_op_lib</span><span>
</span><span id="line-144"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Maybe Text -&gt; Text
forall a. a -&gt; Maybe a -&gt; a
</span><span class="hs-identifier hs-var">fromMaybe</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086241"><span class="hs-identifier hs-var">shortName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Maybe Text
</span><span class="hs-identifier hs-var">Text.stripSuffix</span></span><span> </span><span class="annot"><span class="hs-string">&quot;_ops_op_lib&quot;</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086241"><span class="hs-identifier hs-var">shortName</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-145"></span><span>        </span><span id="local-6989586621679086241"><span class="annot"><span class="annottext">shortName :: Text
</span><a href="#local-6989586621679086241"><span class="hs-identifier hs-var hs-var">shortName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><span class="hs-identifier hs-var">Text.pack</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; String
</span><span class="hs-identifier hs-var">takeBaseName</span></span><span> </span><span class="annot"><span class="annottext">(String -&gt; String) -&gt; String -&gt; String
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpGenFlags -&gt; String
</span><a href="TensorFlow.OpGen.html#outputFile"><span class="hs-identifier hs-var hs-var">outputFile</span></a></span><span> </span><span class="annot"><span class="annottext">OpGenFlags
</span><a href="#local-6989586621679086255"><span class="hs-identifier hs-var">flags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>        </span><span id="local-6989586621679086244"><span class="annot"><span class="annottext">exclusions :: [Text]
</span><a href="#local-6989586621679086244"><span class="hs-identifier hs-var hs-var">exclusions</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; [Text]
</span><span class="hs-identifier hs-var">Text.splitOn</span></span><span> </span><span class="annot"><span class="hs-string">&quot;,&quot;</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; [Text]) -&gt; Text -&gt; [Text]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><span class="hs-identifier hs-var">Text.pack</span></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Text) -&gt; String -&gt; Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">OpGenFlags -&gt; String
</span><a href="TensorFlow.OpGen.html#excludeList"><span class="hs-identifier hs-var hs-var">excludeList</span></a></span><span> </span><span class="annot"><span class="annottext">OpGenFlags
</span><a href="#local-6989586621679086255"><span class="hs-identifier hs-var">flags</span></a></span><span>
</span><span id="line-147"></span><span>        </span><span id="local-6989586621679086249"><span class="annot"><span class="annottext">renderOpAndExtras :: OpDef -&gt; Doc
</span><a href="#local-6989586621679086249"><span class="hs-identifier hs-var hs-var">renderOpAndExtras</span></a></span></span><span> </span><span id="local-6989586621679086238"><span class="annot"><span class="annottext">o :: OpDef
</span><a href="#local-6989586621679086238"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderOp"><span class="hs-identifier hs-var">renderOp</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpDef -&gt; ParsedOp
</span><a href="TensorFlow.OpGen.ParsedOp.html#parseOp"><span class="hs-identifier hs-var">parseOp</span></a></span><span> </span><span class="annot"><span class="annottext">OpDef
</span><a href="#local-6989586621679086238"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">OpDef -&gt; Doc
</span><a href="TensorFlow.OpGen.html#extras"><span class="hs-identifier hs-var">extras</span></a></span><span> </span><span class="annot"><span class="annottext">OpDef
</span><a href="#local-6989586621679086238"><span class="hs-identifier hs-var">o</span></a></span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span class="annot"><a href="TensorFlow.OpGen.html#imports"><span class="hs-identifier hs-type">imports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-150"></span><span id="imports"><span class="annot"><span class="annottext">imports :: Doc
</span><a href="TensorFlow.OpGen.html#imports"><span class="hs-identifier hs-var hs-var">imports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="hs-special">[</span><span>
</span><span id="line-151"></span><span>      </span><span class="annot"><span class="hs-string">&quot;import Data.ByteString (ByteString)&quot;</span></span><span>
</span><span id="line-152"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import Data.Complex (Complex)&quot;</span></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import Data.Int (Int8, Int16, Int32, Int64)&quot;</span></span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import Data.Proxy (Proxy(Proxy))&quot;</span></span><span>
</span><span id="line-155"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import Data.Word (Word8, Word16, Word32, Word64)&quot;</span></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import Lens.Family2 ((.~), (&amp;))&quot;</span></span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import TensorFlow.Build&quot;</span></span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import TensorFlow.BuildOp&quot;</span></span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import TensorFlow.Tensor&quot;</span></span><span>
</span><span id="line-160"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;import TensorFlow.Types&quot;</span></span><span>
</span><span id="line-161"></span><span>    </span><span class="hs-special">]</span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span class="annot"><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-type">renderHaskellName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#renderTFName"><span class="hs-identifier hs-type">renderTFName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-type">renderQuotedTFName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-164"></span><span id="renderHaskellName"><span class="annot"><span class="annottext">renderHaskellName :: Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var hs-var">renderHaskellName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Doc) -&gt; (Name -&gt; Text) -&gt; Name -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">HaskellName -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#unHaskellName"><span class="hs-identifier hs-var hs-var">unHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">(HaskellName -&gt; Text) -&gt; (Name -&gt; HaskellName) -&gt; Name -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; HaskellName
</span><a href="TensorFlow.OpGen.ParsedOp.html#haskellName"><span class="hs-identifier hs-var hs-var">haskellName</span></a></span><span>
</span><span id="line-165"></span><span id="renderTFName"><span class="annot"><span class="annottext">renderTFName :: Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderTFName"><span class="hs-identifier hs-var hs-var">renderTFName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Doc) -&gt; (Name -&gt; Text) -&gt; Name -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">TFName -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#unTFName"><span class="hs-identifier hs-var hs-var">unTFName</span></a></span><span> </span><span class="annot"><span class="annottext">(TFName -&gt; Text) -&gt; (Name -&gt; TFName) -&gt; Name -&gt; Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TFName
</span><a href="TensorFlow.OpGen.ParsedOp.html#tfName"><span class="hs-identifier hs-var hs-var">tfName</span></a></span><span>
</span><span id="line-166"></span><span id="renderQuotedTFName"><span class="annot"><span class="annottext">renderQuotedTFName :: Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var hs-var">renderQuotedTFName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">dquotes</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; (Name -&gt; Doc) -&gt; Name -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderTFName"><span class="hs-identifier hs-var">renderTFName</span></a></span><span>
</span><span id="line-167"></span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span class="hs-comment">-- | Generate the source code for a single op.</span><span>
</span><span id="line-170"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-171"></span><span class="hs-comment">--</span><span>
</span><span id="line-172"></span><span class="hs-comment">-- -- | {haddock comment}</span><span>
</span><span id="line-173"></span><span class="hs-comment">-- foo :: {type sig}</span><span>
</span><span id="line-174"></span><span class="hs-comment">-- foo attr1 attr2 input1 input2 | eqLengthGuard [...] = {function body}</span><span>
</span><span id="line-175"></span><span class="annot"><a href="TensorFlow.OpGen.html#renderOp"><span class="hs-identifier hs-type">renderOp</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedOp"><span class="hs-identifier hs-type">ParsedOp</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-176"></span><span id="renderOp"><span class="annot"><span class="annottext">renderOp :: ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderOp"><span class="hs-identifier hs-var hs-var">renderOp</span></a></span></span><span> </span><span id="local-6989586621679086227"><span class="annot"><span class="annottext">pOp :: ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086226"><span class="hs-identifier hs-var">haddocks</span></a></span><span>
</span><span id="line-178"></span><span>    </span><span class="hs-comment">-- Prevent unreasonably long compilation times on ghc-7.10, due</span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-comment">-- to stack calling &quot;-dump-hi&quot; which (unnecessarily) includes the</span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-comment">-- inlining information, and is large for ops with many arguments.</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &lt; 800
</span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-string">&quot;{-# NOINLINE&quot;</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-operator">&lt;+&gt;</span><span> </span><span class="hs-string">&quot;#-}&quot;</span><span class="hs-cpp">
#endif
</span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086225"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;::&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">hang</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Doc -&gt; ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#typeSig"><span class="hs-identifier hs-var">typeSig</span></a></span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">empty</span></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086225"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;=&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086225"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;' id&quot;</span></span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086223"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;::&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">hang</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Doc -&gt; ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#typeSig"><span class="hs-identifier hs-var">typeSig</span></a></span><span> </span><span class="annot"><span class="hs-string">&quot;OpParams -&gt;&quot;</span></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086223"><span class="hs-identifier hs-var">n'</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">hang</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086222"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;|&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">[Attr (NonEmpty Name)] -&gt; Doc
</span><a href="TensorFlow.OpGen.html#funcGuard"><span class="hs-identifier hs-var">funcGuard</span></a></span><span> </span><span class="annot"><span class="annottext">[Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086220"><span class="hs-identifier hs-var">listSizeAttrs</span></a></span><span>
</span><span id="line-188"></span><span>                </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;=&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span>  </span><span class="hs-comment">-- args are indented</span><span>
</span><span id="line-189"></span><span>                    </span><span class="hs-comment">-- the body needs to be indented wrt the name</span><span>
</span><span id="line-190"></span><span>                    </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">indent</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="TensorFlow.OpGen.html#indentation"><span class="hs-identifier hs-var">indentation</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#functionBody"><span class="hs-identifier hs-var">functionBody</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">[Attr (NonEmpty Name)] -&gt; [Doc]
</span><a href="TensorFlow.OpGen.html#whereClause"><span class="hs-identifier hs-var">whereClause</span></a></span><span> </span><span class="annot"><span class="annottext">[Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086220"><span class="hs-identifier hs-var">listSizeAttrs</span></a></span><span>
</span><span id="line-192"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-193"></span><span>    </span><span id="local-6989586621679086225"><span class="annot"><span class="annottext">n :: Doc
</span><a href="#local-6989586621679086225"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Doc) -&gt; Name -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpName"><span class="hs-identifier hs-var hs-var">parsedOpName</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span>
</span><span id="line-194"></span><span>    </span><span id="local-6989586621679086223"><span class="annot"><span class="annottext">n' :: Doc
</span><a href="#local-6989586621679086223"><span class="hs-identifier hs-var hs-var">n'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086225"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;'&quot;</span></span><span>
</span><span id="line-195"></span><span>    </span><span id="local-6989586621679086220"><span class="annot"><span class="annottext">listSizeAttrs :: [Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086220"><span class="hs-identifier hs-var hs-var">listSizeAttrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr (NonEmpty Name)]
</span><a href="TensorFlow.OpGen.ParsedOp.html#inferredListSizeAttrs"><span class="hs-identifier hs-var hs-var">inferredListSizeAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span>
</span><span id="line-196"></span><span>    </span><span id="local-6989586621679086222"><span class="annot"><span class="annottext">args :: Doc
</span><a href="#local-6989586621679086222"><span class="hs-identifier hs-var hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">sep</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="hs-string">&quot;op'options&quot;</span></span><span>
</span><span id="line-197"></span><span>               </span><span class="annot"><span class="annottext">Doc -&gt; [Doc] -&gt; [Doc]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; Doc) -&gt; [Name] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span>
</span><span id="line-198"></span><span>                    </span><span class="annot"><span class="annottext">([Name] -&gt; [Doc]) -&gt; [Name] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">(Attr AttrType -&gt; Name) -&gt; [Attr AttrType] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Attr AttrType -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr AttrType]
</span><a href="TensorFlow.OpGen.ParsedOp.html#explicitInputAttrs"><span class="hs-identifier hs-var hs-var">explicitInputAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-199"></span><span>                    </span><span class="annot"><span class="annottext">[Name] -&gt; [Name] -&gt; [Name]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">(ParsedArg -&gt; Name) -&gt; [ParsedArg] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgName"><span class="hs-identifier hs-var hs-var">parsedArgName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedInputs"><span class="hs-identifier hs-var hs-var">parsedInputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>    </span><span id="local-6989586621679086226"><span class="annot"><span class="annottext">haddocks :: Doc
</span><a href="#local-6989586621679086226"><span class="hs-identifier hs-var hs-var">haddocks</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;-- |&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#multilineComment"><span class="hs-identifier hs-var">multilineComment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpSummary"><span class="hs-identifier hs-var hs-var">parsedOpSummary</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpDescription"><span class="hs-identifier hs-var hs-var">parsedOpDescription</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086227"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span class="hs-comment">-- | A check that all lists of the given size have the given length.</span><span>
</span><span id="line-203"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-204"></span><span class="hs-comment">--   eqLengthGuard [(&quot;N&quot;, [(&quot;input1&quot;, length input1), (&quot;input2&quot;, length input2)])]</span><span>
</span><span id="line-205"></span><span class="annot"><a href="TensorFlow.OpGen.html#funcGuard"><span class="hs-identifier hs-type">funcGuard</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Attr"><span class="hs-identifier hs-type">Attr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">NonEmpty</span></span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-206"></span><span id="funcGuard"><span class="annot"><span class="annottext">funcGuard :: [Attr (NonEmpty Name)] -&gt; Doc
</span><a href="TensorFlow.OpGen.html#funcGuard"><span class="hs-identifier hs-var hs-var">funcGuard</span></a></span></span><span> </span><span id="local-6989586621679086207"><span class="annot"><span class="annottext">attrs :: [Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086207"><span class="hs-identifier hs-var">attrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;eqLengthGuard&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">commasep</span></span><span> </span><span class="annot"><span class="annottext">[Doc]
</span><a href="#local-6989586621679086206"><span class="hs-identifier hs-var">entries</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-208"></span><span>        </span><span id="local-6989586621679086206"><span class="annot"><span class="annottext">entries :: [Doc]
</span><a href="#local-6989586621679086206"><span class="hs-identifier hs-var hs-var">entries</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-209"></span><span>            </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">parens</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086205"><span class="hs-identifier hs-var">nAttr</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">comma</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span>
</span><span id="line-210"></span><span>              </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">commasep</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc]
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; [a]
</span><span class="hs-identifier hs-var">toList</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; [Doc]) -&gt; [Doc] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-211"></span><span>                            </span><span class="annot"><span class="annottext">(Name -&gt; Doc) -&gt; [Name] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="#local-6989586621679086204"><span class="hs-identifier hs-var">renderTensorName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NonEmpty Name -&gt; [Name]
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; [a]
</span><span class="hs-identifier hs-var">toList</span></span><span> </span><span class="annot"><span class="annottext">(NonEmpty Name -&gt; [Name]) -&gt; NonEmpty Name -&gt; [Name]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name) -&gt; NonEmpty Name
forall a. Attr a -&gt; a
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrInfo"><span class="hs-identifier hs-var hs-var">attrInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086202"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-212"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086202"><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086202"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086207"><span class="hs-identifier hs-var">attrs</span></a></span><span>
</span><span id="line-213"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679086205"><span class="annot"><span class="annottext">nAttr :: Doc
</span><a href="#local-6989586621679086205"><span class="hs-identifier hs-var hs-var">nAttr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var">renderQuotedTFName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Attr (NonEmpty Name) -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086202"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-214"></span><span>            </span><span class="hs-special">]</span><span>
</span><span id="line-215"></span><span>        </span><span id="local-6989586621679086204"><span class="annot"><span class="annottext">renderTensorName :: Name -&gt; Doc
</span><a href="#local-6989586621679086204"><span class="hs-identifier hs-var hs-var">renderTensorName</span></a></span></span><span> </span><span id="local-6989586621679086201"><span class="annot"><span class="annottext">x :: Name
</span><a href="#local-6989586621679086201"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">parens</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var">renderQuotedTFName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086201"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">comma</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span>
</span><span id="line-216"></span><span>                        </span><span class="annot"><span class="hs-string">&quot;length&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086201"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span class="hs-comment">-- | Define the implicit list length attributes.</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-220"></span><span class="hs-comment">--   where</span><span>
</span><span id="line-221"></span><span class="hs-comment">--     n1 = fromIntegral (length input1) :: Int64</span><span>
</span><span id="line-222"></span><span class="hs-comment">--     n2 = fromIntegral (length input2) :: Int64</span><span>
</span><span id="line-223"></span><span class="annot"><a href="TensorFlow.OpGen.html#whereClause"><span class="hs-identifier hs-type">whereClause</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Attr"><span class="hs-identifier hs-type">Attr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">NonEmpty</span></span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span class="hs-special">]</span><span>
</span><span id="line-224"></span><span id="whereClause"><span class="annot"><span class="annottext">whereClause :: [Attr (NonEmpty Name)] -&gt; [Doc]
</span><a href="TensorFlow.OpGen.html#whereClause"><span class="hs-identifier hs-var hs-var">whereClause</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-225"></span><span class="annot"><a href="TensorFlow.OpGen.html#whereClause"><span class="hs-identifier hs-var">whereClause</span></a></span><span> </span><span id="local-6989586621679086200"><span class="annot"><span class="annottext">as :: [Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086200"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">indent</span></span><span> </span><span class="annot"><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="hs-string">&quot;where&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">indent</span></span><span> </span><span class="annot"><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">(Attr (NonEmpty Name) -&gt; Doc) -&gt; [Attr (NonEmpty Name)] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name) -&gt; Doc
</span><a href="#local-6989586621679086199"><span class="hs-identifier hs-var">defineLengthAttr</span></a></span><span> </span><span class="annot"><span class="annottext">[Attr (NonEmpty Name)]
</span><a href="#local-6989586621679086200"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-227"></span><span>    </span><span id="local-6989586621679086199"><span class="annot"><span class="annottext">defineLengthAttr :: Attr (NonEmpty Name) -&gt; Doc
</span><a href="#local-6989586621679086199"><span class="hs-identifier hs-var hs-var">defineLengthAttr</span></a></span></span><span> </span><span id="local-6989586621679086198"><span class="annot"><span class="annottext">a :: Attr (NonEmpty Name)
</span><a href="#local-6989586621679086198"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name) -&gt; Doc
forall a. Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-var">renderHaskellAttrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086198"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;=&quot;</span></span><span>
</span><span id="line-228"></span><span>                            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;fromIntegral (length&quot;</span></span><span>
</span><span id="line-229"></span><span>                            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">NonEmpty Name -&gt; Name
forall a. NonEmpty a -&gt; a
</span><span class="hs-identifier hs-var">NE.head</span></span><span> </span><span class="annot"><span class="annottext">(NonEmpty Name -&gt; Name) -&gt; NonEmpty Name -&gt; Name
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name) -&gt; NonEmpty Name
forall a. Attr a -&gt; a
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrInfo"><span class="hs-identifier hs-var hs-var">attrInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086198"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-230"></span><span>                            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;) :: Int64&quot;</span></span><span>
</span><span id="line-231"></span><span>
</span><span id="line-232"></span><span id="local-6989586621679086338"><span class="annot"><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-type">renderHaskellAttrName</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Attr"><span class="hs-identifier hs-type">Attr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086338"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span></span><span>
</span><span id="line-233"></span><span id="renderHaskellAttrName"><span class="annot"><span class="annottext">renderHaskellAttrName :: Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-var hs-var">renderHaskellAttrName</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Doc) -&gt; (Attr a -&gt; Name) -&gt; Attr a -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Attr a -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span>
</span><span id="line-234"></span><span>
</span><span id="line-235"></span><span class="annot"><a href="TensorFlow.OpGen.html#functionBody"><span class="hs-identifier hs-type">functionBody</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedOp"><span class="hs-identifier hs-type">ParsedOp</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-236"></span><span id="functionBody"><span class="annot"><span class="annottext">functionBody :: ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#functionBody"><span class="hs-identifier hs-var hs-var">functionBody</span></a></span></span><span> </span><span id="local-6989586621679086195"><span class="annot"><span class="annottext">pOp :: ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span></span><span>
</span><span id="line-237"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; Bool
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpIsMonadic"><span class="hs-identifier hs-var hs-var">parsedOpIsMonadic</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span>
</span><span id="line-238"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;build $ do&quot;</span></span><span>
</span><span id="line-239"></span><span>            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">indent</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="TensorFlow.OpGen.html#indentation"><span class="hs-identifier hs-var">indentation</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086193"><span class="hs-identifier hs-var">bindOpInputsVar</span></a></span><span>
</span><span id="line-240"></span><span>                        </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;buildOp&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086192"><span class="hs-identifier hs-var">outputListsSizes</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086191"><span class="hs-identifier hs-var">opDef</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-241"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span>
</span><span id="line-242"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;pureOp&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086192"><span class="hs-identifier hs-var">outputListsSizes</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;$ do&quot;</span></span><span>
</span><span id="line-243"></span><span>            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">indent</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="TensorFlow.OpGen.html#indentation"><span class="hs-identifier hs-var">indentation</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086193"><span class="hs-identifier hs-var">bindOpInputsVar</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;return&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086191"><span class="hs-identifier hs-var">opDef</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-244"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-245"></span><span>    </span><span id="local-6989586621679086192"><span class="annot"><span class="annottext">outputListsSizes :: Doc
</span><a href="#local-6989586621679086192"><span class="hs-identifier hs-var hs-var">outputListsSizes</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">commasep</span></span><span>
</span><span id="line-246"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086190"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-247"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedArg"><span class="hs-identifier hs-type">ParsedArg</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">parsedArgCase :: ParsedArg -&gt; ParsedArgCase
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgCase"><span class="hs-identifier hs-var">parsedArgCase</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ListArg"><span class="hs-identifier hs-type">ListArg</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">argLength :: ParsedArgCase -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#argLength"><span class="hs-identifier hs-var">argLength</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086190"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086190"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-248"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOutputs"><span class="hs-identifier hs-var hs-var">parsedOutputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span>
</span><span id="line-249"></span><span>        </span><span class="hs-special">]</span><span>
</span><span id="line-250"></span><span>    </span><span id="local-6989586621679086184"><span class="annot"><span class="annottext">opInputsVar :: Doc
</span><a href="#local-6989586621679086184"><span class="hs-identifier hs-var hs-var">opInputsVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;op'inputs&quot;</span></span><span>
</span><span id="line-251"></span><span>    </span><span id="local-6989586621679086193"><span class="annot"><span class="annottext">bindOpInputsVar :: Doc
</span><a href="#local-6989586621679086193"><span class="hs-identifier hs-var hs-var">bindOpInputsVar</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086184"><span class="hs-identifier hs-var">opInputsVar</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;&lt;- fmap Prelude.concat $ Prelude.sequence&quot;</span></span><span>
</span><span id="line-252"></span><span>                            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">commasep</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; [Doc] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679086183"><span class="annot"><span class="annottext">a :: Doc
</span><a href="#local-6989586621679086183"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;buildInputs&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086183"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Doc]
</span><a href="#local-6989586621679086182"><span class="hs-identifier hs-var">tensorArgs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-253"></span><span>    </span><span id="local-6989586621679086191"><span class="annot"><span class="annottext">opDef :: Doc
</span><a href="#local-6989586621679086191"><span class="hs-identifier hs-var hs-var">opDef</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">parens</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">hang</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-254"></span><span>        </span><span class="annot"><span class="hs-string">&quot;opDef&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var">renderQuotedTFName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpName"><span class="hs-identifier hs-var hs-var">parsedOpName</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; [Doc] -&gt; [Doc]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span>
</span><span id="line-255"></span><span>        </span><span class="hs-comment">-- Renders type parameter arguments.</span><span>
</span><span id="line-256"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-string">&quot;&amp; opAttr&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var">renderQuotedTFName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086181"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;.~&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Doc
</span><a href="#local-6989586621679086180"><span class="hs-identifier hs-var">inferredTypeExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086179"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-257"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086179"><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086179"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr TypeParam]
</span><a href="TensorFlow.OpGen.ParsedOp.html#inferredTypeAttrs"><span class="hs-identifier hs-var hs-var">inferredTypeAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679086181"><span class="annot"><span class="annottext">n :: Name
</span><a href="#local-6989586621679086181"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086179"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-258"></span><span>        </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span>
</span><span id="line-259"></span><span>        </span><span class="hs-comment">-- Renders mandatory attributes as function parameters.</span><span>
</span><span id="line-260"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-string">&quot;&amp; opAttr&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var">renderQuotedTFName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086177"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;.~&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086177"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-261"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086176"><span class="annot"><span class="annottext">Attr AttrType
</span><a href="#local-6989586621679086176"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr AttrType]
</span><a href="TensorFlow.OpGen.ParsedOp.html#explicitInputAttrs"><span class="hs-identifier hs-var hs-var">explicitInputAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679086177"><span class="annot"><span class="annottext">n :: Name
</span><a href="#local-6989586621679086177"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Attr AttrType -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr AttrType
</span><a href="#local-6989586621679086176"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-262"></span><span>        </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span>
</span><span id="line-263"></span><span>        </span><span class="hs-comment">-- Renders sizes of tensor list types having number_attr.</span><span>
</span><span id="line-264"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-string">&quot;&amp; opAttr&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderQuotedTFName"><span class="hs-identifier hs-var">renderQuotedTFName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086175"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;.~&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086175"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-265"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086174"><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086174"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr (NonEmpty Name)]
</span><a href="TensorFlow.OpGen.ParsedOp.html#inferredListSizeAttrs"><span class="hs-identifier hs-var hs-var">inferredListSizeAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679086175"><span class="annot"><span class="annottext">n :: Name
</span><a href="#local-6989586621679086175"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name) -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr (NonEmpty Name)
</span><a href="#local-6989586621679086174"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-266"></span><span>        </span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span>
</span><span id="line-267"></span><span>        </span><span class="hs-special">[</span><span class="annot"><span class="hs-string">&quot;&amp; op'options &amp; opInputs .~&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086184"><span class="hs-identifier hs-var">opInputsVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-268"></span><span>    </span><span id="local-6989586621679086182"><span class="annot"><span class="annottext">tensorArgs :: [Doc]
</span><a href="#local-6989586621679086182"><span class="hs-identifier hs-var hs-var">tensorArgs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="#local-6989586621679086173"><span class="hs-identifier hs-var">renderTensorArg</span></a></span><span> </span><span class="annot"><span class="annottext">(ParsedArg -&gt; Doc) -&gt; [ParsedArg] -&gt; [Doc]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><span class="hs-operator hs-var">&lt;$&gt;</span></span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedInputs"><span class="hs-identifier hs-var hs-var">parsedInputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086195"><span class="hs-identifier hs-var">pOp</span></a></span><span>
</span><span id="line-269"></span><span>    </span><span id="local-6989586621679086173"><span class="annot"><span class="annottext">renderTensorArg :: ParsedArg -&gt; Doc
</span><a href="#local-6989586621679086173"><span class="hs-identifier hs-var hs-var">renderTensorArg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Doc) -&gt; (ParsedArg -&gt; Name) -&gt; ParsedArg -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgName"><span class="hs-identifier hs-var hs-var">parsedArgName</span></a></span><span>
</span><span id="line-270"></span><span>    </span><span id="local-6989586621679086180"><span class="annot"><span class="annottext">inferredTypeExpr :: Attr TypeParam -&gt; Doc
</span><a href="#local-6989586621679086180"><span class="hs-identifier hs-var hs-var">inferredTypeExpr</span></a></span></span><span> </span><span id="local-6989586621679086172"><span class="annot"><span class="annottext">a :: Attr TypeParam
</span><a href="#local-6989586621679086172"><span class="hs-identifier hs-var">a</span></a></span></span><span>
</span><span id="line-271"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TypeParam -&gt; Bool
</span><a href="TensorFlow.OpGen.ParsedOp.html#typeParamIsList"><span class="hs-identifier hs-var hs-var">typeParamIsList</span></a></span><span> </span><span class="annot"><span class="annottext">(TypeParam -&gt; Bool) -&gt; TypeParam -&gt; Bool
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; TypeParam
forall a. Attr a -&gt; a
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrInfo"><span class="hs-identifier hs-var hs-var">attrInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086172"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-272"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;fromTensorTypes (Proxy :: Proxy&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Doc
forall a. Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-var">renderHaskellAttrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086172"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-273"></span><span>                    </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-274"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;tensorType (undefined ::&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Doc
forall a. Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-var">renderHaskellAttrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086172"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-275"></span><span>                            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;)&quot;</span></span><span>
</span><span id="line-276"></span><span>
</span><span id="line-277"></span><span class="hs-comment">-- | Write a comment with the inputs/outputs/attributes in proto format, for</span><span>
</span><span id="line-278"></span><span class="hs-comment">-- debugging.</span><span>
</span><span id="line-279"></span><span class="annot"><a href="TensorFlow.OpGen.html#extras"><span class="hs-identifier hs-type">extras</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpDef</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-280"></span><span id="extras"><span class="annot"><span class="annottext">extras :: OpDef -&gt; Doc
</span><a href="TensorFlow.OpGen.html#extras"><span class="hs-identifier hs-var hs-var">extras</span></a></span></span><span> </span><span id="local-6989586621679086170"><span class="annot"><span class="annottext">d :: OpDef
</span><a href="#local-6989586621679086170"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">enclose</span></span><span> </span><span class="annot"><span class="hs-string">&quot;{-\n&quot;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;\n-}&quot;</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-281"></span><span>            </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Doc) -&gt; Text -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; Text
</span><span class="hs-identifier hs-var">Text.pack</span></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Text) -&gt; String -&gt; Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span>
</span><span id="line-282"></span><span>            </span><span class="annot"><span class="annottext">OpDef -&gt; String
forall msg. Message msg =&gt; msg -&gt; String
</span><span class="hs-identifier hs-var">showMessage</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpDef
forall a. Message a =&gt; a
</span><span class="hs-identifier hs-var">def</span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">OpDef</span></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>                        </span><span class="annot"><span class="annottext">OpDef -&gt; (OpDef -&gt; OpDef) -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f OpDef [OpDef'ArgDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;inputArg&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">inputArg</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f OpDef [OpDef'ArgDef])
-&gt; [OpDef'ArgDef] -&gt; OpDef -&gt; OpDef
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpDef
</span><a href="#local-6989586621679086170"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">OpDef
-&gt; FoldLike
     [OpDef'ArgDef] OpDef OpDef [OpDef'ArgDef] [OpDef'ArgDef]
-&gt; [OpDef'ArgDef]
forall s a t b. s -&gt; FoldLike a s t a b -&gt; a
</span><span class="hs-operator hs-var">^.</span></span><span> </span><span class="annot"><span class="annottext">FoldLike [OpDef'ArgDef] OpDef OpDef [OpDef'ArgDef] [OpDef'ArgDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;inputArg&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">inputArg</span></span><span class="hs-special">)</span><span>
</span><span id="line-284"></span><span>                        </span><span class="annot"><span class="annottext">OpDef -&gt; (OpDef -&gt; OpDef) -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f OpDef [OpDef'ArgDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;outputArg&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">outputArg</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f OpDef [OpDef'ArgDef])
-&gt; [OpDef'ArgDef] -&gt; OpDef -&gt; OpDef
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpDef
</span><a href="#local-6989586621679086170"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">OpDef
-&gt; FoldLike
     [OpDef'ArgDef] OpDef OpDef [OpDef'ArgDef] [OpDef'ArgDef]
-&gt; [OpDef'ArgDef]
forall s a t b. s -&gt; FoldLike a s t a b -&gt; a
</span><span class="hs-operator hs-var">^.</span></span><span> </span><span class="annot"><span class="annottext">FoldLike [OpDef'ArgDef] OpDef OpDef [OpDef'ArgDef] [OpDef'ArgDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;outputArg&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">outputArg</span></span><span class="hs-special">)</span><span>
</span><span id="line-285"></span><span>                        </span><span class="annot"><span class="annottext">OpDef -&gt; (OpDef -&gt; OpDef) -&gt; OpDef
forall s t. s -&gt; (s -&gt; t) -&gt; t
</span><span class="hs-operator hs-var">&amp;</span></span><span> </span><span class="annot"><span class="annottext">forall (f :: * -&gt; *).
Identical f =&gt;
LensLike' f OpDef [OpDef'AttrDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;attr&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">attr</span></span><span> </span><span class="annot"><span class="annottext">(forall (f :: * -&gt; *).
 Identical f =&gt;
 LensLike' f OpDef [OpDef'AttrDef])
-&gt; [OpDef'AttrDef] -&gt; OpDef -&gt; OpDef
forall s t a b. Setter s t a b -&gt; b -&gt; s -&gt; t
</span><span class="hs-operator hs-var">.~</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OpDef
</span><a href="#local-6989586621679086170"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">OpDef
-&gt; FoldLike
     [OpDef'AttrDef] OpDef OpDef [OpDef'AttrDef] [OpDef'AttrDef]
-&gt; [OpDef'AttrDef]
forall s a t b. s -&gt; FoldLike a s t a b -&gt; a
</span><span class="hs-operator hs-var">^.</span></span><span> </span><span class="annot"><span class="annottext">FoldLike
  [OpDef'AttrDef] OpDef OpDef [OpDef'AttrDef] [OpDef'AttrDef]
forall (f :: * -&gt; *) s a.
(Functor f, HasField s &quot;attr&quot; a) =&gt;
LensLike' f s a
</span><span class="hs-identifier hs-var">attr</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span class="hs-comment">-- | The type signature for an op.</span><span>
</span><span id="line-288"></span><span class="hs-comment">-- Of the form:</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- forall t1 t2 v1 v2 . (TensorType t1, TensorType t2)</span><span>
</span><span id="line-290"></span><span class="hs-comment">--      =&gt; {pre} Float -&gt; Tensor t1 v1 -&gt; Tensor t2 v2</span><span>
</span><span id="line-291"></span><span class="hs-comment">-- where &quot;Float&quot; is an explicit input attribute, &quot;Tensor t1 v1&quot; is an input, and</span><span>
</span><span id="line-292"></span><span class="hs-comment">-- &quot;Tensor t2 v2&quot; is an output.</span><span>
</span><span id="line-293"></span><span class="annot"><a href="TensorFlow.OpGen.html#typeSig"><span class="hs-identifier hs-type">typeSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedOp"><span class="hs-identifier hs-type">ParsedOp</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-294"></span><span id="typeSig"><span class="annot"><span class="annottext">typeSig :: Doc -&gt; ParsedOp -&gt; Doc
</span><a href="TensorFlow.OpGen.html#typeSig"><span class="hs-identifier hs-var hs-var">typeSig</span></a></span></span><span> </span><span id="local-6989586621679086169"><span class="annot"><span class="annottext">pre :: Doc
</span><a href="#local-6989586621679086169"><span class="hs-identifier hs-var">pre</span></a></span></span><span> </span><span id="local-6989586621679086168"><span class="annot"><span class="annottext">pOp :: ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086167"><span class="hs-identifier hs-var">constraints</span></a></span><span>
</span><span id="line-295"></span><span>            </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+/&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086169"><span class="hs-identifier hs-var">pre</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><a href="#local-6989586621679086166"><span class="hs-identifier hs-var">signatureFold</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Attr AttrType -&gt; Doc) -&gt; [Attr AttrType] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Attr AttrType -&gt; Doc
</span><a href="#local-6989586621679086165"><span class="hs-identifier hs-var">attrInput</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr AttrType]
</span><a href="TensorFlow.OpGen.ParsedOp.html#explicitInputAttrs"><span class="hs-identifier hs-var hs-var">explicitInputAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-296"></span><span>                                </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">(ParsedArg -&gt; Doc) -&gt; [ParsedArg] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="#local-6989586621679086164"><span class="hs-identifier hs-var">tensorArgAndComment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedInputs"><span class="hs-identifier hs-var hs-var">parsedInputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>                                </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086163"><span class="hs-identifier hs-var">outputs</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-298"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-299"></span><span>    </span><span id="local-6989586621679086167"><span class="annot"><span class="annottext">constraints :: Doc
</span><a href="#local-6989586621679086167"><span class="hs-identifier hs-var hs-var">constraints</span></a></span></span><span>
</span><span id="line-300"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><span class="hs-identifier hs-var">null</span></span><span> </span><span class="annot"><span class="annottext">[Doc]
</span><a href="#local-6989586621679086161"><span class="hs-identifier hs-var">classConstraints</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">empty</span></span><span>
</span><span id="line-301"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;forall&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">sep</span></span><span> </span><span class="annot"><span class="annottext">[Doc]
</span><a href="#local-6989586621679086160"><span class="hs-identifier hs-var">typeParams</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;.&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">tuple</span></span><span> </span><span class="annot"><span class="annottext">[Doc]
</span><a href="#local-6989586621679086161"><span class="hs-identifier hs-var">classConstraints</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;=&gt;&quot;</span></span><span>
</span><span id="line-302"></span><span>    </span><span id="local-6989586621679086160"><span class="annot"><span class="annottext">typeParams :: [Doc]
</span><a href="#local-6989586621679086160"><span class="hs-identifier hs-var hs-var">typeParams</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086159"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086158"><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086158"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedInputs"><span class="hs-identifier hs-var hs-var">parsedInputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span> </span><span class="annot"><span class="annottext">[ParsedArg] -&gt; [ParsedArg] -&gt; [ParsedArg]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOutputs"><span class="hs-identifier hs-var hs-var">parsedOutputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-303"></span><span>                  </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgSomeTensor"><span class="hs-identifier hs-type">ArgSomeTensor</span></a></span><span> </span><span id="local-6989586621679086159"><span class="annot"><span class="annottext">v :: Text
</span><a href="#local-6989586621679086159"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ParsedArgCase -&gt; ArgKind
</span><a href="TensorFlow.OpGen.ParsedOp.html#argKind"><span class="hs-identifier hs-var hs-var">argKind</span></a></span><span> </span><span class="annot"><span class="annottext">(ParsedArgCase -&gt; ArgKind) -&gt; ParsedArgCase -&gt; ArgKind
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; ParsedArgCase
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgCase"><span class="hs-identifier hs-var hs-var">parsedArgCase</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086158"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-304"></span><span>                </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Doc
forall a. Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-var">renderHaskellAttrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086155"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086155"><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086155"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr TypeParam]
</span><a href="TensorFlow.OpGen.ParsedOp.html#inferredTypeAttrs"><span class="hs-identifier hs-var hs-var">inferredTypeAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-305"></span><span>                </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; Bool
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpIsMonadic"><span class="hs-identifier hs-var hs-var">parsedOpIsMonadic</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-string">&quot;m'&quot;</span></span><span class="hs-special">]</span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-306"></span><span>    </span><span class="hs-comment">-- Use m' as the type parameter to avoid clashing with an attribute name.</span><span>
</span><span id="line-307"></span><span>    </span><span id="local-6989586621679086154"><span class="annot"><span class="annottext">monadConstraint :: [Doc]
</span><a href="#local-6989586621679086154"><span class="hs-identifier hs-var hs-var">monadConstraint</span></a></span></span><span>
</span><span id="line-308"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; Bool
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpIsMonadic"><span class="hs-identifier hs-var hs-var">parsedOpIsMonadic</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-string">&quot;MonadBuild m'&quot;</span></span><span class="hs-special">]</span><span>
</span><span id="line-309"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-310"></span><span>    </span><span id="local-6989586621679086161"><span class="annot"><span class="annottext">classConstraints :: [Doc]
</span><a href="#local-6989586621679086161"><span class="hs-identifier hs-var hs-var">classConstraints</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Doc]
</span><a href="#local-6989586621679086154"><span class="hs-identifier hs-var">monadConstraint</span></a></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; [Doc] -&gt; [Doc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">(Attr TypeParam -&gt; Doc) -&gt; [Attr TypeParam] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Doc
</span><a href="TensorFlow.OpGen.html#tensorArgConstraint"><span class="hs-identifier hs-var">tensorArgConstraint</span></a></span><span>
</span><span id="line-311"></span><span>                                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedOp -&gt; [Attr TypeParam]
</span><a href="TensorFlow.OpGen.ParsedOp.html#inferredTypeAttrs"><span class="hs-identifier hs-var hs-var">inferredTypeAttrs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-312"></span><span>    </span><span id="local-6989586621679086166"><span class="annot"><span class="annottext">signatureFold :: [Doc] -&gt; Doc
</span><a href="#local-6989586621679086166"><span class="hs-identifier hs-var hs-var">signatureFold</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc -&gt; Doc) -&gt; [Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">folddoc</span></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621679086152"><span class="annot"><span class="annottext">x :: Doc
</span><a href="#local-6989586621679086152"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621679086151"><span class="annot"><span class="annottext">y :: Doc
</span><a href="#local-6989586621679086151"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086152"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;-&gt;&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086151"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-313"></span><span>    </span><span id="local-6989586621679086165"><span class="annot"><span class="annottext">attrInput :: Attr AttrType -&gt; Doc
</span><a href="#local-6989586621679086165"><span class="hs-identifier hs-var hs-var">attrInput</span></a></span></span><span> </span><span id="local-6989586621679086150"><span class="annot"><span class="annottext">a :: Attr AttrType
</span><a href="#local-6989586621679086150"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AttrType -&gt; Doc
</span><a href="#local-6989586621679086149"><span class="hs-identifier hs-var">renderAttrType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Attr AttrType -&gt; AttrType
forall a. Attr a -&gt; a
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrInfo"><span class="hs-identifier hs-var hs-var">attrInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Attr AttrType
</span><a href="#local-6989586621679086150"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">hang</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-string">&quot;-- ^&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Attr AttrType -&gt; Doc
forall a. Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#attrComment"><span class="hs-identifier hs-var">attrComment</span></a></span><span> </span><span class="annot"><span class="annottext">Attr AttrType
</span><a href="#local-6989586621679086150"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-314"></span><span>    </span><span id="local-6989586621679086149"><span class="annot"><span class="annottext">renderAttrType :: AttrType -&gt; Doc
</span><a href="#local-6989586621679086149"><span class="hs-identifier hs-var hs-var">renderAttrType</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrSingle"><span class="hs-identifier hs-type">AttrSingle</span></a></span><span> </span><span id="local-6989586621679086146"><span class="annot"><span class="annottext">a :: AttrBaseType
</span><a href="#local-6989586621679086146"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AttrBaseType -&gt; Doc
</span><a href="#local-6989586621679086145"><span class="hs-identifier hs-var">renderAttrBaseType</span></a></span><span> </span><span class="annot"><span class="annottext">AttrBaseType
</span><a href="#local-6989586621679086146"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-315"></span><span>    </span><span class="annot"><a href="#local-6989586621679086149"><span class="hs-identifier hs-var">renderAttrType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrList"><span class="hs-identifier hs-type">AttrList</span></a></span><span> </span><span id="local-6989586621679086143"><span class="annot"><span class="annottext">a :: AttrBaseType
</span><a href="#local-6989586621679086143"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">AttrBaseType -&gt; Doc
</span><a href="#local-6989586621679086145"><span class="hs-identifier hs-var">renderAttrBaseType</span></a></span><span> </span><span class="annot"><span class="annottext">AttrBaseType
</span><a href="#local-6989586621679086143"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-316"></span><span>    </span><span id="local-6989586621679086145"><span class="annot"><span class="annottext">renderAttrBaseType :: AttrBaseType -&gt; Doc
</span><a href="#local-6989586621679086145"><span class="hs-identifier hs-var hs-var">renderAttrBaseType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-317"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrBytes"><span class="hs-identifier hs-type">AttrBytes</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;ByteString&quot;</span></span><span>
</span><span id="line-318"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrInt64"><span class="hs-identifier hs-type">AttrInt64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int64&quot;</span></span><span>
</span><span id="line-319"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrFloat"><span class="hs-identifier hs-type">AttrFloat</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Float&quot;</span></span><span>
</span><span id="line-320"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrBool"><span class="hs-identifier hs-type">AttrBool</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Bool&quot;</span></span><span>
</span><span id="line-321"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrType"><span class="hs-identifier hs-type">AttrType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;DataType&quot;</span></span><span>
</span><span id="line-322"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrShape"><span class="hs-identifier hs-type">AttrShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Shape&quot;</span></span><span>
</span><span id="line-323"></span><span>        </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#AttrTensor"><span class="hs-identifier hs-type">AttrTensor</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;TensorProto&quot;</span></span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span>    </span><span id="local-6989586621679086164"><span class="annot"><span class="annottext">tensorArgAndComment :: ParsedArg -&gt; Doc
</span><a href="#local-6989586621679086164"><span class="hs-identifier hs-var hs-var">tensorArgAndComment</span></a></span></span><span> </span><span id="local-6989586621679086135"><span class="annot"><span class="annottext">t :: ParsedArg
</span><a href="#local-6989586621679086135"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#tensorArg"><span class="hs-identifier hs-var">tensorArg</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086135"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Doc -&gt; Doc
</span><span class="hs-identifier hs-var">hang</span></span><span> </span><span class="annot"><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-string">&quot;-- ^&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment"><span class="hs-identifier hs-var">argComment</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086135"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-326"></span><span>    </span><span id="local-6989586621679086163"><span class="annot"><span class="annottext">outputs :: Doc
</span><a href="#local-6989586621679086163"><span class="hs-identifier hs-var hs-var">outputs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; [ParsedArg]
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOutputs"><span class="hs-identifier hs-var hs-var">parsedOutputs</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-327"></span><span>        </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="#local-6989586621679086132"><span class="hs-identifier hs-var">wrapOutput</span></a></span><span> </span><span class="annot"><span class="hs-string">&quot;ControlNode&quot;</span></span><span>
</span><span id="line-328"></span><span>        </span><span class="hs-comment">-- TODO(judahjacobson): To improve indentation: `tensorArgAndComment a`</span><span>
</span><span id="line-329"></span><span>        </span><span class="hs-special">[</span><span id="local-6989586621679086131"><span class="annot"><span class="annottext">a :: ParsedArg
</span><a href="#local-6989586621679086131"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="#local-6989586621679086132"><span class="hs-identifier hs-var">wrapOutput</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#tensorArg"><span class="hs-identifier hs-var">tensorArg</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086131"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;-- ^&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment"><span class="hs-identifier hs-var">argComment</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086131"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-330"></span><span>        </span><span id="local-6989586621679086130"><span class="annot"><span class="annottext">as :: [ParsedArg]
</span><a href="#local-6989586621679086130"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="#local-6989586621679086132"><span class="hs-identifier hs-var">wrapOutput</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">tuple</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ParsedArg -&gt; Doc) -&gt; [ParsedArg] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#tensorArg"><span class="hs-identifier hs-var">tensorArg</span></a></span><span> </span><span class="annot"><span class="annottext">[ParsedArg]
</span><a href="#local-6989586621679086130"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+/&gt;</span></span><span> </span><span class="annot"><span class="annottext">[ParsedArg] -&gt; Doc
</span><a href="TensorFlow.OpGen.html#resultComment"><span class="hs-identifier hs-var">resultComment</span></a></span><span> </span><span class="annot"><span class="annottext">[ParsedArg]
</span><a href="#local-6989586621679086130"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-331"></span><span>    </span><span id="local-6989586621679086132"><span class="annot"><span class="annottext">wrapOutput :: Doc -&gt; Doc
</span><a href="#local-6989586621679086132"><span class="hs-identifier hs-var hs-var">wrapOutput</span></a></span></span><span> </span><span id="local-6989586621679086128"><span class="annot"><span class="annottext">o :: Doc
</span><a href="#local-6989586621679086128"><span class="hs-identifier hs-var">o</span></a></span></span><span>
</span><span id="line-332"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ParsedOp -&gt; Bool
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedOpIsMonadic"><span class="hs-identifier hs-var hs-var">parsedOpIsMonadic</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedOp
</span><a href="#local-6989586621679086168"><span class="hs-identifier hs-var">pOp</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;m'&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">parens</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086128"><span class="hs-identifier hs-var">o</span></a></span><span>
</span><span id="line-333"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">otherwise</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086128"><span class="hs-identifier hs-var">o</span></a></span><span>
</span><span id="line-334"></span><span>
</span><span id="line-335"></span><span class="hs-comment">-- | Render an op input or output.</span><span>
</span><span id="line-336"></span><span class="hs-comment">-- For example: &quot;Tensor Ref Int64&quot;, &quot;Tensor v t&quot;</span><span>
</span><span id="line-337"></span><span class="annot"><a href="TensorFlow.OpGen.html#tensorArg"><span class="hs-identifier hs-type">tensorArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedArg"><span class="hs-identifier hs-type">ParsedArg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-338"></span><span id="tensorArg"><span class="annot"><span class="annottext">tensorArg :: ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#tensorArg"><span class="hs-identifier hs-var hs-var">tensorArg</span></a></span></span><span> </span><span id="local-6989586621679086127"><span class="annot"><span class="annottext">p :: ParsedArg
</span><a href="#local-6989586621679086127"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; ParsedArgCase
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgCase"><span class="hs-identifier hs-var hs-var">parsedArgCase</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086127"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-339"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#SimpleArg"><span class="hs-identifier hs-type">SimpleArg</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">argType :: ParsedArgCase -&gt; ArgType
</span><a href="TensorFlow.OpGen.ParsedOp.html#argType"><span class="hs-identifier hs-var">argType</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086124"><span class="annot"><span class="annottext">ArgType
</span><a href="#local-6989586621679086124"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">argKind :: ParsedArgCase -&gt; ArgKind
</span><a href="TensorFlow.OpGen.ParsedOp.html#argKind"><span class="hs-identifier hs-var">argKind</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086123"><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086123"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgType -&gt; ArgKind -&gt; Doc
</span><a href="#local-6989586621679086122"><span class="hs-identifier hs-var">tensorType</span></a></span><span> </span><span class="annot"><span class="annottext">ArgType
</span><a href="#local-6989586621679086124"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086123"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-340"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ListArg"><span class="hs-identifier hs-type">ListArg</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">argType :: ParsedArgCase -&gt; ArgType
</span><a href="TensorFlow.OpGen.ParsedOp.html#argType"><span class="hs-identifier hs-var">argType</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086121"><span class="annot"><span class="annottext">ArgType
</span><a href="#local-6989586621679086121"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">argKind :: ParsedArgCase -&gt; ArgKind
</span><a href="TensorFlow.OpGen.ParsedOp.html#argKind"><span class="hs-identifier hs-var">argKind</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086120"><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086120"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Doc -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ArgType -&gt; ArgKind -&gt; Doc
</span><a href="#local-6989586621679086122"><span class="hs-identifier hs-var">tensorType</span></a></span><span> </span><span class="annot"><span class="annottext">ArgType
</span><a href="#local-6989586621679086121"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086120"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-341"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#MixedListArg"><span class="hs-identifier hs-type">MixedListArg</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">argTypeAttr :: ParsedArgCase -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#argTypeAttr"><span class="hs-identifier hs-var">argTypeAttr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086117"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086117"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">argKind :: ParsedArgCase -&gt; ArgKind
</span><a href="TensorFlow.OpGen.ParsedOp.html#argKind"><span class="hs-identifier hs-var">argKind</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621679086116"><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086116"><span class="hs-identifier hs-var">k</span></a></span></span><span class="hs-special">}</span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;TensorList&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">parens</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgKind -&gt; Doc
</span><a href="#local-6989586621679086115"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086116"><span class="hs-identifier hs-var">k</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086117"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-343"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-344"></span><span>    </span><span id="local-6989586621679086115"><span class="annot"><span class="annottext">kind :: ArgKind -&gt; Doc
</span><a href="#local-6989586621679086115"><span class="hs-identifier hs-var hs-var">kind</span></a></span></span><span> </span><span id="local-6989586621679086114"><span class="annot"><span class="annottext">k :: ArgKind
</span><a href="#local-6989586621679086114"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086114"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-345"></span><span>                </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgTensorRef"><span class="hs-identifier hs-type">ArgTensorRef</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Ref&quot;</span></span><span>
</span><span id="line-346"></span><span>                </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgTensorValue"><span class="hs-identifier hs-type">ArgTensorValue</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Value&quot;</span></span><span>
</span><span id="line-347"></span><span>                </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgTensorBuild"><span class="hs-identifier hs-type">ArgTensorBuild</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;Build&quot;</span></span><span>
</span><span id="line-348"></span><span>                </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgSomeTensor"><span class="hs-identifier hs-type">ArgSomeTensor</span></a></span><span> </span><span id="local-6989586621679086110"><span class="annot"><span class="annottext">v :: Text
</span><a href="#local-6989586621679086110"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086110"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-349"></span><span>    </span><span id="local-6989586621679086122"><span class="annot"><span class="annottext">tensorType :: ArgType -&gt; ArgKind -&gt; Doc
</span><a href="#local-6989586621679086122"><span class="hs-identifier hs-var hs-var">tensorType</span></a></span></span><span> </span><span id="local-6989586621679086109"><span class="annot"><span class="annottext">t :: ArgType
</span><a href="#local-6989586621679086109"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621679086108"><span class="annot"><span class="annottext">k :: ArgKind
</span><a href="#local-6989586621679086108"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-350"></span><span>        </span><span id="local-6989586621679086107"><span class="annot"><span class="annottext">a :: Doc
</span><a href="#local-6989586621679086107"><span class="hs-identifier hs-var hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgType
</span><a href="#local-6989586621679086109"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-351"></span><span>                </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgTypeFixed"><span class="hs-identifier hs-type">ArgTypeFixed</span></a></span><span> </span><span id="local-6989586621679086105"><span class="annot"><span class="annottext">dt :: DataType
</span><a href="#local-6989586621679086105"><span class="hs-identifier hs-var">dt</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Doc) -&gt; Text -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">DataType -&gt; Text
</span><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="#local-6989586621679086105"><span class="hs-identifier hs-var">dt</span></a></span><span>
</span><span id="line-352"></span><span>                </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ArgTypeAttr"><span class="hs-identifier hs-type">ArgTypeAttr</span></a></span><span> </span><span id="local-6989586621679086102"><span class="annot"><span class="annottext">n :: Name
</span><a href="#local-6989586621679086102"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellName"><span class="hs-identifier hs-var">renderHaskellName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086102"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-353"></span><span>        </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="hs-string">&quot;Tensor&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">ArgKind -&gt; Doc
</span><a href="#local-6989586621679086115"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="annot"><span class="annottext">ArgKind
</span><a href="#local-6989586621679086108"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086107"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-354"></span><span>
</span><span id="line-355"></span><span id="local-6989586621679086101"><span class="annot"><a href="TensorFlow.OpGen.html#attrComment"><span class="hs-identifier hs-type">attrComment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Attr"><span class="hs-identifier hs-type">Attr</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679086101"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span></span><span>
</span><span id="line-356"></span><span id="attrComment"><span class="annot"><span class="annottext">attrComment :: Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#attrComment"><span class="hs-identifier hs-var hs-var">attrComment</span></a></span></span><span> </span><span id="local-6989586621679086100"><span class="annot"><span class="annottext">a :: Attr a
</span><a href="#local-6989586621679086100"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment%27"><span class="hs-identifier hs-var">argComment'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Attr a -&gt; Name
forall a. Attr a -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrName"><span class="hs-identifier hs-var hs-var">attrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr a
</span><a href="#local-6989586621679086100"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Attr a -&gt; Text
forall a. Attr a -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrDescription"><span class="hs-identifier hs-var hs-var">attrDescription</span></a></span><span> </span><span class="annot"><span class="annottext">Attr a
</span><a href="#local-6989586621679086100"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span class="annot"><a href="TensorFlow.OpGen.html#argComment"><span class="hs-identifier hs-type">argComment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedArg"><span class="hs-identifier hs-type">ParsedArg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-359"></span><span id="argComment"><span class="annot"><span class="annottext">argComment :: ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment"><span class="hs-identifier hs-var hs-var">argComment</span></a></span></span><span> </span><span id="local-6989586621679086097"><span class="annot"><span class="annottext">a :: ParsedArg
</span><a href="#local-6989586621679086097"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment%27"><span class="hs-identifier hs-var">argComment'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedArg -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgName"><span class="hs-identifier hs-var hs-var">parsedArgName</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086097"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ParsedArg -&gt; Text
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgDescription"><span class="hs-identifier hs-var hs-var">parsedArgDescription</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086097"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="annot"><a href="TensorFlow.OpGen.html#argComment%27"><span class="hs-identifier hs-type">argComment'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Text.Text</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-362"></span><span id="argComment%27"><span class="annot"><span class="annottext">argComment' :: Name -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment%27"><span class="hs-identifier hs-var hs-var">argComment'</span></a></span></span><span> </span><span id="local-6989586621679086095"><span class="annot"><span class="annottext">argName :: Name
</span><a href="#local-6989586621679086095"><span class="hs-identifier hs-var">argName</span></a></span></span><span> </span><span id="local-6989586621679086094"><span class="annot"><span class="annottext">argDesc :: Text
</span><a href="#local-6989586621679086094"><span class="hs-identifier hs-var">argDesc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-363"></span><span>    </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="TensorFlow.OpGen.html#bold"><span class="hs-identifier hs-var">bold</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderTFName"><span class="hs-identifier hs-var">renderTFName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621679086095"><span class="hs-identifier hs-var">argName</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#splitMultilineText"><span class="hs-identifier hs-var">splitMultilineText</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-string">&quot;:&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086094"><span class="hs-identifier hs-var">argDesc</span></a></span><span>
</span><span id="line-364"></span><span>
</span><span id="line-365"></span><span class="annot"><a href="TensorFlow.OpGen.html#bold"><span class="hs-identifier hs-type">bold</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-366"></span><span id="bold"><span class="annot"><span class="annottext">bold :: Doc -&gt; Doc
</span><a href="TensorFlow.OpGen.html#bold"><span class="hs-identifier hs-var hs-var">bold</span></a></span></span><span> </span><span id="local-6989586621679086091"><span class="annot"><span class="annottext">n :: Doc
</span><a href="#local-6989586621679086091"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;__&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086091"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;__&quot;</span></span><span>
</span><span id="line-367"></span><span>
</span><span id="line-368"></span><span class="hs-comment">-- | Comment for the outputs of an op.</span><span>
</span><span id="line-369"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-370"></span><span class="hs-comment">--   -- ^ (__output1__, __output2__)</span><span>
</span><span id="line-371"></span><span class="hs-comment">--   --</span><span>
</span><span id="line-372"></span><span class="hs-comment">--   -- * __output1__: description1</span><span>
</span><span id="line-373"></span><span class="hs-comment">--   --</span><span>
</span><span id="line-374"></span><span class="hs-comment">--   -- * __output2__: description2</span><span>
</span><span id="line-375"></span><span class="annot"><a href="TensorFlow.OpGen.html#resultComment"><span class="hs-identifier hs-type">resultComment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#ParsedArg"><span class="hs-identifier hs-type">ParsedArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-376"></span><span id="resultComment"><span class="annot"><span class="annottext">resultComment :: [ParsedArg] -&gt; Doc
</span><a href="TensorFlow.OpGen.html#resultComment"><span class="hs-identifier hs-var hs-var">resultComment</span></a></span></span><span> </span><span id="local-6989586621679086090"><span class="annot"><span class="annottext">os :: [ParsedArg]
</span><a href="#local-6989586621679086090"><span class="hs-identifier hs-var">os</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">flatten</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086089"><span class="hs-identifier hs-var">commentSummary</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; [Doc] -&gt; [Doc]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(ParsedArg -&gt; Doc) -&gt; [ParsedArg] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="#local-6989586621679086088"><span class="hs-identifier hs-var">commentDetails</span></a></span><span> </span><span class="annot"><span class="annottext">[ParsedArg]
</span><a href="#local-6989586621679086090"><span class="hs-identifier hs-var">os</span></a></span><span>
</span><span id="line-377"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-378"></span><span>    </span><span id="local-6989586621679086089"><span class="annot"><span class="annottext">commentSummary :: Doc
</span><a href="#local-6989586621679086089"><span class="hs-identifier hs-var hs-var">commentSummary</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;-- ^&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">tuple</span></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="TensorFlow.OpGen.html#bold"><span class="hs-identifier hs-var">bold</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderTFName"><span class="hs-identifier hs-var">renderTFName</span></a></span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Doc) -&gt; Name -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Name
</span><a href="TensorFlow.OpGen.ParsedOp.html#parsedArgName"><span class="hs-identifier hs-var hs-var">parsedArgName</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086087"><span class="hs-identifier hs-var">o</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621679086087"><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086087"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[ParsedArg]
</span><a href="#local-6989586621679086090"><span class="hs-identifier hs-var">os</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-379"></span><span>    </span><span id="local-6989586621679086088"><span class="annot"><span class="annottext">commentDetails :: ParsedArg -&gt; Doc
</span><a href="#local-6989586621679086088"><span class="hs-identifier hs-var hs-var">commentDetails</span></a></span></span><span> </span><span id="local-6989586621679086086"><span class="annot"><span class="annottext">o :: ParsedArg
</span><a href="#local-6989586621679086086"><span class="hs-identifier hs-var">o</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-380"></span><span>        </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="hs-string">&quot;--&quot;</span></span><span>
</span><span id="line-381"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="hs-string">&quot;-- *&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">ParsedArg -&gt; Doc
</span><a href="TensorFlow.OpGen.html#argComment"><span class="hs-identifier hs-var">argComment</span></a></span><span> </span><span class="annot"><span class="annottext">ParsedArg
</span><a href="#local-6989586621679086086"><span class="hs-identifier hs-var">o</span></a></span><span>
</span><span id="line-382"></span><span>              </span><span class="hs-special">]</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span class="hs-comment">-- | Constraints for a given type parameter.</span><span>
</span><span id="line-385"></span><span class="hs-comment">-- E.g.: &quot;TensorType t&quot; or &quot;OneOf [Int64, Float] t&quot;</span><span>
</span><span id="line-386"></span><span class="hs-comment">-- or &quot;TensorTypes ts&quot; or &quot;OneOfs [..] ts&quot;.</span><span>
</span><span id="line-387"></span><span class="annot"><a href="TensorFlow.OpGen.html#tensorArgConstraint"><span class="hs-identifier hs-type">tensorArgConstraint</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#Attr"><span class="hs-identifier hs-type">Attr</span></a></span><span> </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#TypeParam"><span class="hs-identifier hs-type">TypeParam</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-388"></span><span id="tensorArgConstraint"><span class="annot"><span class="annottext">tensorArgConstraint :: Attr TypeParam -&gt; Doc
</span><a href="TensorFlow.OpGen.html#tensorArgConstraint"><span class="hs-identifier hs-var hs-var">tensorArgConstraint</span></a></span></span><span> </span><span id="local-6989586621679086085"><span class="annot"><span class="annottext">a :: Attr TypeParam
</span><a href="#local-6989586621679086085"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; TypeParam
forall a. Attr a -&gt; a
</span><a href="TensorFlow.OpGen.ParsedOp.html#attrInfo"><span class="hs-identifier hs-var hs-var">attrInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086085"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-389"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#TypeParam"><span class="hs-identifier hs-type">TypeParam</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">False</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Nothing</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;TensorType&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086083"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-390"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#TypeParam"><span class="hs-identifier hs-type">TypeParam</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">False</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Just</span></span><span> </span><span id="local-6989586621679086082"><span class="annot"><span class="annottext">as :: NonEmpty DataType
</span><a href="#local-6989586621679086082"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;OneOf&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">NonEmpty DataType -&gt; Doc
</span><a href="#local-6989586621679086081"><span class="hs-identifier hs-var">typeList</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty DataType
</span><a href="#local-6989586621679086082"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086083"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-391"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#TypeParam"><span class="hs-identifier hs-type">TypeParam</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">True</span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Nothing</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;TensorTypes&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086083"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-392"></span><span>    </span><span class="annot"><a href="TensorFlow.OpGen.ParsedOp.html#TypeParam"><span class="hs-identifier hs-type">TypeParam</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">True</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Just</span></span><span> </span><span id="local-6989586621679086080"><span class="annot"><span class="annottext">as :: NonEmpty DataType
</span><a href="#local-6989586621679086080"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-string">&quot;OneOfs&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">NonEmpty DataType -&gt; Doc
</span><a href="#local-6989586621679086081"><span class="hs-identifier hs-var">typeList</span></a></span><span> </span><span class="annot"><span class="annottext">NonEmpty DataType
</span><a href="#local-6989586621679086080"><span class="hs-keyword hs-var">as</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086083"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-394"></span><span>    </span><span id="local-6989586621679086083"><span class="annot"><span class="annottext">n :: Doc
</span><a href="#local-6989586621679086083"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Attr TypeParam -&gt; Doc
forall a. Attr a -&gt; Doc
</span><a href="TensorFlow.OpGen.html#renderHaskellAttrName"><span class="hs-identifier hs-var">renderHaskellAttrName</span></a></span><span> </span><span class="annot"><span class="annottext">Attr TypeParam
</span><a href="#local-6989586621679086085"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-395"></span><span>    </span><span class="hs-comment">-- Produces a type-level list, e.g.: '[Int32,Int64,Float]</span><span>
</span><span id="line-396"></span><span>    </span><span id="local-6989586621679086081"><span class="annot"><span class="annottext">typeList :: NonEmpty DataType -&gt; Doc
</span><a href="#local-6989586621679086081"><span class="hs-identifier hs-var hs-var">typeList</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-string">&quot;'&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><span class="hs-operator hs-var">&lt;&gt;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc)
-&gt; (NonEmpty DataType -&gt; Doc) -&gt; NonEmpty DataType -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><span class="hs-identifier hs-var">brackets</span></span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc)
-&gt; (NonEmpty DataType -&gt; Doc) -&gt; NonEmpty DataType -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">commasep</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc)
-&gt; (NonEmpty DataType -&gt; [Doc]) -&gt; NonEmpty DataType -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Doc) -&gt; [Text] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; [Doc])
-&gt; (NonEmpty DataType -&gt; [Text]) -&gt; NonEmpty DataType -&gt; [Doc]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span>
</span><span id="line-397"></span><span>                    </span><span class="annot"><span class="annottext">Set Text -&gt; [Text]
forall a. Set a -&gt; [a]
</span><span class="hs-identifier hs-var">Set.toList</span></span><span> </span><span class="annot"><span class="annottext">(Set Text -&gt; [Text])
-&gt; (NonEmpty DataType -&gt; Set Text) -&gt; NonEmpty DataType -&gt; [Text]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">[Text] -&gt; Set Text
forall a. Ord a =&gt; [a] -&gt; Set a
</span><span class="hs-identifier hs-var">Set.fromList</span></span><span> </span><span class="annot"><span class="annottext">([Text] -&gt; Set Text)
-&gt; (NonEmpty DataType -&gt; [Text]) -&gt; NonEmpty DataType -&gt; Set Text
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span>
</span><span id="line-398"></span><span>                    </span><span class="annot"><span class="annottext">(DataType -&gt; Text) -&gt; [DataType] -&gt; [Text]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="annot"><span class="annottext">DataType -&gt; Text
</span><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="annottext">([DataType] -&gt; [Text])
-&gt; (NonEmpty DataType -&gt; [DataType]) -&gt; NonEmpty DataType -&gt; [Text]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">NonEmpty DataType -&gt; [DataType]
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; [a]
</span><span class="hs-identifier hs-var">toList</span></span><span>
</span><span id="line-399"></span><span>
</span><span id="line-400"></span><span class="hs-comment">-- NOTE: The cases of this function should be kept in sync with</span><span>
</span><span id="line-401"></span><span class="hs-comment">-- TensorFlow.Types.AllTensorTypes.</span><span>
</span><span id="line-402"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-type">dtTypeToHaskell</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">DataType</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Text.Text</span></span><span>
</span><span id="line-403"></span><span id="dtTypeToHaskell"><span class="annot"><span class="annottext">dtTypeToHaskell :: DataType -&gt; Text
</span><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var hs-var">dtTypeToHaskell</span></a></span></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_BOOL</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Bool&quot;</span></span><span>
</span><span id="line-404"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_BFLOAT16</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word16&quot;</span></span><span>
</span><span id="line-405"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_COMPLEX128</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;(Data.Complex.Complex Double)&quot;</span></span><span>
</span><span id="line-406"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_COMPLEX64</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;(Data.Complex.Complex Float)&quot;</span></span><span>
</span><span id="line-407"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_DOUBLE</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Double&quot;</span></span><span>
</span><span id="line-408"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_FLOAT</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Float&quot;</span></span><span>
</span><span id="line-409"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_INT16</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int16&quot;</span></span><span>
</span><span id="line-410"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_INT32</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int32&quot;</span></span><span>
</span><span id="line-411"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_INT64</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int64&quot;</span></span><span>
</span><span id="line-412"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_INT8</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int8&quot;</span></span><span>
</span><span id="line-413"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_QINT32</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int32&quot;</span></span><span>  </span><span class="hs-comment">-- TODO(gnezdo): make unique</span><span>
</span><span id="line-414"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_QINT8</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word8&quot;</span></span><span>  </span><span class="hs-comment">-- TODO(gnezdo): make unique</span><span>
</span><span id="line-415"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_QINT16</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Int.Int16&quot;</span></span><span>  </span><span class="hs-comment">-- TODO(gnezdo): make unique</span><span>
</span><span id="line-416"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_QUINT16</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word16&quot;</span></span><span>  </span><span class="hs-comment">-- TODO(gnezdo): make unique</span><span>
</span><span id="line-417"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_QUINT8</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word8&quot;</span></span><span>  </span><span class="hs-comment">-- TODO(gnezdo): make unique</span><span>
</span><span id="line-418"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_STRING</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.ByteString.ByteString&quot;</span></span><span>
</span><span id="line-419"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_UINT16</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word16&quot;</span></span><span>
</span><span id="line-420"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_UINT32</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word32&quot;</span></span><span>
</span><span id="line-421"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_UINT64</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word64&quot;</span></span><span>
</span><span id="line-422"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_HALF</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word16&quot;</span></span><span>  </span><span class="hs-comment">-- TODO(gnezdo): make unique</span><span>
</span><span id="line-423"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_UINT8</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Data.Word.Word8&quot;</span></span><span>
</span><span id="line-424"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_RESOURCE</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;ResourceHandle&quot;</span></span><span>
</span><span id="line-425"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">DT_VARIANT</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;Variant&quot;</span></span><span>
</span><span id="line-426"></span><span class="annot"><a href="TensorFlow.OpGen.html#dtTypeToHaskell"><span class="hs-identifier hs-var">dtTypeToHaskell</span></a></span><span> </span><span id="local-6989586621679086054"><span class="annot"><span class="annottext">x :: DataType
</span><a href="#local-6989586621679086054"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-427"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; Text
</span><span class="hs-identifier hs-var">Text.pack</span></span><span> </span><span class="annot"><span class="annottext">(String -&gt; Text) -&gt; String -&gt; Text
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="hs-string">&quot;Unsupported type in dtTypeToHaskell: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><span class="hs-operator hs-var">++</span></span><span> </span><span class="annot"><span class="annottext">DataType -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><span class="hs-identifier hs-var">show</span></span><span> </span><span class="annot"><span class="annottext">DataType
</span><a href="#local-6989586621679086054"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span class="hs-comment">-- | haddockComment escapes TensorFlow doc strings into haddock.</span><span>
</span><span id="line-430"></span><span class="hs-comment">-- TODO(gnezdo): deal with the markup.</span><span>
</span><span id="line-431"></span><span class="annot"><a href="TensorFlow.OpGen.html#haddockComment"><span class="hs-identifier hs-type">haddockComment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Text.Text</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-432"></span><span id="haddockComment"><span class="annot"><span class="annottext">haddockComment :: Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#haddockComment"><span class="hs-identifier hs-var hs-var">haddockComment</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><span class="hs-identifier hs-var">strictText</span></span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span class="hs-comment">-- | Generate a multiline comment.  For example:</span><span>
</span><span id="line-435"></span><span class="hs-comment">--   summary'</span><span>
</span><span id="line-436"></span><span class="hs-comment">--   --</span><span>
</span><span id="line-437"></span><span class="hs-comment">--   -- detail_line1</span><span>
</span><span id="line-438"></span><span class="hs-comment">--   -- detail_line2</span><span>
</span><span id="line-439"></span><span class="hs-comment">--   -- ...</span><span>
</span><span id="line-440"></span><span class="annot"><a href="TensorFlow.OpGen.html#multilineComment"><span class="hs-identifier hs-type">multilineComment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Text.Text</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Text.Text</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-441"></span><span id="multilineComment"><span class="annot"><span class="annottext">multilineComment :: Text -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#multilineComment"><span class="hs-identifier hs-var hs-var">multilineComment</span></a></span></span><span> </span><span id="local-6989586621679086051"><span class="annot"><span class="annottext">summary' :: Text
</span><a href="#local-6989586621679086051"><span class="hs-identifier hs-var">summary'</span></a></span></span><span> </span><span id="local-6989586621679086050"><span class="annot"><span class="annottext">detail :: Text
</span><a href="#local-6989586621679086050"><span class="hs-identifier hs-var">detail</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-442"></span><span>    </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#haddockComment"><span class="hs-identifier hs-var">haddockComment</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086051"><span class="hs-identifier hs-var">summary'</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span>
</span><span id="line-443"></span><span>    </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#splitMultilineText"><span class="hs-identifier hs-var">splitMultilineText</span></a></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="#local-6989586621679086049"><span class="hs-identifier hs-var">insertParagraphAndComment</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086050"><span class="hs-identifier hs-var">detail</span></a></span><span>
</span><span id="line-444"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621679086049"><span class="annot"><span class="annottext">insertParagraphAndComment :: Doc -&gt; Doc
</span><a href="#local-6989586621679086049"><span class="hs-identifier hs-var hs-var">insertParagraphAndComment</span></a></span></span><span> </span><span id="local-6989586621679086048"><span class="annot"><span class="annottext">x :: Doc
</span><a href="#local-6989586621679086048"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;/&gt;</span></span><span> </span><span class="annot"><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span> </span><span class="annot"><span class="annottext">Doc
</span><a href="#local-6989586621679086048"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-445"></span><span>
</span><span id="line-446"></span><span class="hs-comment">-- | Converts the given multi-line detail string into</span><span>
</span><span id="line-447"></span><span class="hs-comment">-- a multi-line haddock. Applies the given lead to the</span><span>
</span><span id="line-448"></span><span class="hs-comment">-- first line. Returns an empty document for empty detail.</span><span>
</span><span id="line-449"></span><span class="annot"><a href="TensorFlow.OpGen.html#splitMultilineText"><span class="hs-identifier hs-type">splitMultilineText</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Text.Text</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Doc</span></span><span>
</span><span id="line-450"></span><span id="splitMultilineText"><span class="annot"><span class="annottext">splitMultilineText :: (Doc -&gt; Doc) -&gt; Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#splitMultilineText"><span class="hs-identifier hs-var hs-var">splitMultilineText</span></a></span></span><span> </span><span id="local-6989586621679086047"><span class="annot"><span class="annottext">lead :: Doc -&gt; Doc
</span><a href="#local-6989586621679086047"><span class="hs-identifier hs-var">lead</span></a></span></span><span> </span><span id="local-6989586621679086046"><span class="annot"><span class="annottext">detail :: Text
</span><a href="#local-6989586621679086046"><span class="hs-identifier hs-var">detail</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-451"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Text -&gt; [Text]
</span><span class="hs-identifier hs-var">Text.lines</span></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086046"><span class="hs-identifier hs-var">detail</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-452"></span><span>    </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Doc
</span><span class="hs-identifier hs-var">empty</span></span><span>
</span><span id="line-453"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679086044"><span class="annot"><span class="annottext">l :: Text
</span><a href="#local-6989586621679086044"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621679086043"><span class="annot"><span class="annottext">ls :: [Text]
</span><a href="#local-6989586621679086043"><span class="hs-identifier hs-var">ls</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Doc] -&gt; Doc
</span><span class="hs-identifier hs-var">stack</span></span><span> </span><span class="annot"><span class="annottext">([Doc] -&gt; Doc) -&gt; [Doc] -&gt; Doc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><span class="hs-operator hs-var">$</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc
</span><a href="#local-6989586621679086047"><span class="hs-identifier hs-var">lead</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#haddockComment"><span class="hs-identifier hs-var">haddockComment</span></a></span><span> </span><span class="annot"><span class="annottext">Text
</span><a href="#local-6989586621679086044"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span>                      </span><span class="annot"><span class="annottext">Doc -&gt; [Doc] -&gt; [Doc]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(Text -&gt; Doc) -&gt; [Text] -&gt; [Doc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><span class="hs-identifier hs-var">map</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="hs-string">&quot;--&quot;</span></span><span> </span><span class="annot"><span class="annottext">Doc -&gt; Doc -&gt; Doc
</span><span class="hs-operator hs-var">&lt;+&gt;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Doc -&gt; Doc) -&gt; (Text -&gt; Doc) -&gt; Text -&gt; Doc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><span class="hs-operator hs-var">.</span></span><span> </span><span class="annot"><span class="annottext">Text -&gt; Doc
</span><a href="TensorFlow.OpGen.html#haddockComment"><span class="hs-identifier hs-var">haddockComment</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Text]
</span><a href="#local-6989586621679086043"><span class="hs-identifier hs-var">ls</span></a></span><span>
</span><span id="line-455"></span><span>
</span><span id="line-456"></span><span class="annot"><a href="TensorFlow.OpGen.html#indentation"><span class="hs-identifier hs-type">indentation</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-457"></span><span id="indentation"><span class="annot"><span class="annottext">indentation :: Int
</span><a href="TensorFlow.OpGen.html#indentation"><span class="hs-identifier hs-var hs-var">indentation</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-number">4</span></span><span>
</span><span id="line-458"></span></pre></body></html>